﻿using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;
using YZQ_DotNetArx.CAD;

namespace YZQ_DotNetArx.Test
{
    public static class 创建和编辑图形
    {
        [CommandMethod("CSEntTools")]
        public static void CSEntTools()
        {
            PromptEntityResult psr = Env.Editor.GetEntity("\n请选择实体");
            if (psr.Status != PromptStatus.OK) return;
            ObjectId id = psr.ObjectId;
            using (Transaction trans = Env.Database.TransactionManager.StartTransaction())
            {
                Entity ent = id.GetObject(OpenMode.ForWrite) as Entity;
                if (ent == null) return;
                //ent.Move(Point3d.Origin,new Point3d(100,100,0));
                //id.Move(Point3d.Origin, new Point3d(100, 100, 0));
                //ent.Copy(Point3d.Origin, new Point3d(100, 100, 0));
                ent.Move(new Point3d(0, 0, 0), new Point3d(-100, -100, 0));
                id.Copy(Point3d.Origin, new Point3d(100, 100, 0));
                trans.Commit();
            }

        }
    }
}

